import request from '../index'
import { newsState } from '@/enum'

export function getList(index: number, size: number, state?: number) {
  return request.get('/news', {
    index,
    size,
    state: state !== undefined ? state : newsState['已通过']
  })
}

export function getAuditList(index: number, size: number) {
  return request.get('/news', {
    index,
    size,
    state: newsState['待审核']
  })
}

export function pass(id: string) {
  return request.put('/news', {
    id,
    state: newsState['已通过']
  })
}

export function noPass(id: string) {
  return request.put('/news', {
    id,
    state: newsState['未通过']
  })
}

export function delNews(id: string) {
  return request.delete('/news', {
    id
  })
}